import formatTime from "../../../util/formatTime.js"
import { detailSql, getResult, onDuplicByFiled, deleteSql, putSql } from "../../../util/operateSql.js"

const TABLE = 'robot.robots'

export const bot_login = async (args) => {
  const {socketId,nickname,loginCode} = args
  // const sql = detailSql(TABLE,{weId,nickname},'or')
  // const rows = await getResult(sql)
  const sql = onDuplicByFiled(TABLE,{nickname,socketId ,loginCode,updateTime:formatTime()})
  return getResult(sql)
}


export const bot_logout = async (args) => {
  const {weId,nickname,loginCode} = args
  const sql = putSql(TABLE,{weId})
  getResult(sql)
}

export const bot_message = async (args) => {
  const {} = args
}